//
//  TYZNavigationController.m
//  TYZ_SC
//
//  Created by 李贤立 on 2017/12/12.
//  Copyright © 2017年 Capfer. All rights reserved.
//

#import "TYZNavigationController.h"
#import "UIImage+Friend.h"
#define  NavigationTitleFontSize     20
#define  NavigationTitleColor        [UIColor whiteColor]
#define  BarButtonItemFontSize       16
#define  BarButtonItemColor          [UIColor whiteColor]

@interface TYZNavigationController ()
@end

@implementation TYZNavigationController

+ (void)initialize {
    UINavigationBar *navBar = [UINavigationBar appearance];
    // 返回箭头
    navBar.tintColor = [UIColor whiteColor];
    navBar.translucent = NO;
    // 导航栏背景
//    [navBar setBackgroundImage:[[UIImage imageNamed:NavigationImageName] stretchableImageWithLeftCapWidth:20 topCapHeight:20] forBarMetrics:UIBarMetricsDefault];
    [navBar setBarTintColor:TYZBlueColor];
    
    // 导航栏标题颜色
    NSMutableDictionary *titleAttributes = [NSMutableDictionary dictionary];
    titleAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:NavigationTitleFontSize];
    titleAttributes[NSForegroundColorAttributeName] = NavigationTitleColor;
    [navBar setTitleTextAttributes:titleAttributes];
    // 导航栏底部线条颜色
    [navBar setShadowImage:[UIImage imageWithColor:[UIColor clearColor]]];
    
    // BarButtonItem
    UIBarButtonItem *item = [UIBarButtonItem appearance];
    NSMutableDictionary *itemAttributes = [NSMutableDictionary dictionary];
    itemAttributes[NSFontAttributeName] = [UIFont systemFontOfSize:BarButtonItemFontSize];
    itemAttributes[NSForegroundColorAttributeName] = BarButtonItemColor;
    [item setTitleTextAttributes:itemAttributes forState:UIControlStateNormal];
}
- (void)loadView {
    [super loadView];
    // 顶部状态栏的颜色
    self.navigationBar.barStyle = UIBarStyleBlackOpaque;
}
/// push进入下一个普通控制器的时候是否隐藏导航条
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    viewController.hidesBottomBarWhenPushed = YES;
    [super pushViewController:viewController animated:animated];
}

@end
